import request from '@/utils/request';

// 查询员工列表
export function listEmployee(query) {
  return request({
    url: '/tms/employee/list',
    method: 'get',
    params: query
  });
}

// 查询员工详细
export function getEmployee(employeeId) {
  return request({
    url: '/tms/employee/' + employeeId,
    method: 'get'
  });
}

// 新增员工
export function addEmployee(data) {
  return request({
    url: '/tms/employee',
    method: 'post',
    data: data
  });
}

// 修改员工
export function updateEmployee(data) {
  return request({
    url: '/tms/employee',
    method: 'put',
    data: data
  });
}

// 删除员工
export function deleteEmployee(employeeId) {
  return request({
    url: '/tms/employee/' + employeeId,
    method: 'delete'
  });
}

// 导出员工
export function exportEmployee(query) {
  return request({
    url: '/tms/employee/export',
    method: 'get',
    params: query,
    responseType: 'blob'
  });
}

// 导入员工
export function importEmployee(formData) {
  return request({
    url: '/tms/employee/import',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    timeout: 60000 // 设置较长的超时时间，因为导入可能需要处理大量数据
  });
}
